namespace MSD.WL.Site.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Add_Annotation_Name_Major : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AfterServers",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        CustomerCode = c.String(maxLength: 10),
                        SerDate = c.DateTime(nullable: false),
                        EmployeeCode = c.String(maxLength: 10),
                        Linkman = c.String(maxLength: 10),
                        TelephoneCode = c.String(maxLength: 13),
                        SerDays = c.Int(nullable: false),
                        SerContent = c.String(),
                        Resolvent = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Chances",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        ChanceCode = c.String(maxLength: 10),
                        ChanceName = c.String(maxLength: 20),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Customers",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        CustomerCode = c.String(maxLength: 10),
                        CustomerName = c.String(maxLength: 50),
                        EmployeeCode = c.String(maxLength: 10),
                        AtrMan = c.String(maxLength: 10),
                        TelephoneCode = c.String(maxLength: 13),
                        FaxCode = c.String(maxLength: 13),
                        PostCode = c.String(maxLength: 6),
                        Email = c.String(maxLength: 20),
                        Linkman = c.String(maxLength: 10),
                        Url = c.String(maxLength: 50),
                        Address = c.String(maxLength: 100),
                        GradeCode = c.String(maxLength: 10),
                        StateCode = c.String(maxLength: 10),
                        CreditCode = c.String(maxLength: 10),
                        TradeCode = c.String(maxLength: 10),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.DepartmentTypes",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        DepartmentCode = c.String(maxLength: 10),
                        DepartmentName = c.String(maxLength: 20),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Employees",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        EmployeeCode = c.String(maxLength: 10),
                        EmployeeName = c.String(maxLength: 10),
                        DepartmentCode = c.String(maxLength: 10),
                        Age = c.Int(nullable: false),
                        Sex = c.Int(nullable: false),
                        EduLevel = c.Int(nullable: false),
                        Job = c.String(maxLength: 20),
                        JoinDate = c.DateTime(nullable: false),
                        TelephoneCode = c.String(maxLength: 13),
                        Remark = c.String(maxLength: 500),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Invens",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        InvenCode = c.String(maxLength: 10),
                        InvenName = c.String(maxLength: 40),
                        InvenTypeCode = c.String(maxLength: 10),
                        SpecsModel = c.String(maxLength: 30),
                        MeaUnit = c.String(maxLength: 10),
                        SelPrice = c.String(maxLength: 10),
                        PurPrice = c.String(maxLength: 10),
                        SmallStockNum = c.Int(nullable: false),
                        BigStockNum = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.InvenTypes",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        InvenTypeCode = c.String(maxLength: 10),
                        InvenTypeName = c.String(maxLength: 20),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.ProduceItems",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        ProduceCode = c.String(maxLength: 20),
                        InvenCode = c.String(maxLength: 10),
                        Quantity = c.Int(nullable: false),
                        GetQuantity = c.Int(nullable: false),
                        UseQuantity = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.ProducePlans",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        PlanCode = c.String(maxLength: 20),
                        PlanDate = c.DateTime(nullable: false),
                        OperatorCode = c.String(maxLength: 10),
                        SEOrderCode = c.String(maxLength: 20),
                        InvenCode = c.String(maxLength: 10),
                        Quantity = c.Int(nullable: false),
                        FinishDate = c.DateTime(nullable: false),
                        IsFlag = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.RelRecords",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        CustomerCode = c.String(maxLength: 10),
                        RelDate = c.DateTime(nullable: false),
                        RelManner = c.String(maxLength: 2),
                        Linkman = c.String(maxLength: 10),
                        TelephoneCode = c.String(maxLength: 13),
                        NextDate = c.DateTime(nullable: false),
                        RelContent = c.String(),
                        FeeInfo = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.SEGathers",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        SEGatherCode = c.String(maxLength: 20),
                        SEGatherDate = c.DateTime(nullable: false),
                        OperatorCode = c.String(maxLength: 10),
                        CustomerCode = c.String(maxLength: 10),
                        SEMoney = c.Int(nullable: false),
                        AccountCode = c.String(maxLength: 19),
                        EmployeeCode = c.String(maxLength: 10),
                        Remark = c.String(maxLength: 500),
                        IsFlag = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.SEOrders",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        SEOrderCode = c.String(maxLength: 20),
                        SEOrderDate = c.DateTime(nullable: false),
                        OperatorCode = c.String(maxLength: 10),
                        CustomerCode = c.String(maxLength: 10),
                        StoreCode = c.String(maxLength: 10),
                        InvenCode = c.String(maxLength: 10),
                        SellPrice = c.Int(nullable: false),
                        Quantity = c.Int(nullable: false),
                        SEMoney = c.Int(nullable: false),
                        SenInvenDate = c.DateTime(nullable: false),
                        EmployeeCode = c.String(maxLength: 10),
                        IsFlag = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        OperatorCode = c.String(maxLength: 10),
                        OperatorName = c.String(maxLength: 10),
                        PassWord = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.Users");
            DropTable("dbo.SEOrders");
            DropTable("dbo.SEGathers");
            DropTable("dbo.RelRecords");
            DropTable("dbo.ProducePlans");
            DropTable("dbo.ProduceItems");
            DropTable("dbo.InvenTypes");
            DropTable("dbo.Invens");
            DropTable("dbo.Employees");
            DropTable("dbo.DepartmentTypes");
            DropTable("dbo.Customers");
            DropTable("dbo.Chances");
            DropTable("dbo.AfterServers");
        }
    }
}
